package com.example.librarymanagementsystembackend.utils;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/exception")
public class ExceptionController {
    @RequestMapping("")
    public void handleException(HttpServletRequest request) throws Exception {
        Object invalidRequestException =  request.getAttribute("invalidRequestException");
        if (invalidRequestException instanceof InvalidRequestException) {
            throw (InvalidRequestException) invalidRequestException;
        }
    }
}
